<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="/common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<c:set var="md" value="on"/>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="${base}/css/orderinput.css" />
		<title>${siteName}</title>
		<%@ include file="/common/commonstyle.jsp" %>
		<script type="text/javascript">
			function servicedateFouce(){
				var week = $("#week").val();
				var maxDate = 2;
				if("星期四" == week || "星期五" == week || "星期六" == week) {
					maxDate = 4;
				} else if("星期日" == week) {
					maxDate = 3;
				}
				WdatePicker({
					readOnly:true,
					minDate:'%y-%M-%d',
					maxDate:'%y-%M-{%d+' + maxDate + '}',
					doubleCalendar:true,
					dateFmt:'yyyy-MM-dd',
					disabledDays:[6,0]
				})
			}
		
			$(function() {
				$("#loginForm").submit(function(){
					var password = $("#password").val();
					if(null == email || "" == email) {
						jAlert("<spring:message code='loginempty' />");
						return false;
					} else if(null == password || "" == password) {
						jAlert("<spring:message code='loginempty' />");
						return false;
					} else {
						return true;
					}
				});
				
				//验证信息
				$.formValidator.initConfig({
					formID: "orderForm",
					debug:false,
					onError: function(msg, obj, errorlist){
						jAlert(msg);
					}
				});
				$("#username").formValidator({onShow:"请输入用户名！", onCorrect:"恭喜你,你输对了"}).inputValidator({min:2, max:25, onError:"用户名为2-25个字！"}).regexValidator({regExp: "Illegal", dataType:"enum", onError:"用户名中包含非法字符！"});
				$("#phone").formValidator({onShow:"请输入电话/手机号码！", onCorrect:"恭喜你,你输对了"}).regexValidator({regExp: "telphone", dataType:"enum", onError:"你输入的电话/手机号码格式不正确！"});
				$("#email").formValidator({onShow:"请输入email！", onCorrect:"恭喜你,你输对了"}).regexValidator({regExp: "email", dataType:"enum", onError:"你输入的email格式不正确！"});
				$("#comment").formValidator({empty:true, onShow:"请输入备注信息！", onCorrect:"恭喜你,你输对了"}).inputValidator({max:250, onError:"备注最多可输入250个字！"}).regexValidator({regExp: "Illegal", dataType:"enum", onError:"备注信息中包含非法字符！"});
				$("#site").formValidator({onShow:"请输入配送地址！", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, max:250, onError:"配送地址长度为1-250个字！"}).regexValidator({regExp: "Illegal", dataType:"enum", onError:"用户名中包含非法字符！"});
				$("#servicedate").formValidator({onShow:"请选择配送日期！", onCorrect:"恭喜你,你输对了"}).inputValidator({min:10, max:25, onError:"请选择配送日期！"});
				$("#servicetime").formValidator({onShow:"请选择配送时间！", onCorrect:"恭喜你,你输对了"}).inputValidator({min:8, onError:"请选择配送时间！"});
				$("#deliveryremark").formValidator({empty:true, onShow:"请输入配送备注！", onCorrect:"恭喜你,你输对了"}).inputValidator({min:0, max:250, onError:"配送备注最多可输入250个字！"}).regexValidator({regExp: "Illegal", dataType:"enum", onError:"配送备注中包含非法字符！"});
			});
		</script>
	</head>
	
	<body>
		<div class="main">
                    <%@ include file="/common/header.jsp" %>
		    <div class="delivery">
		    	<div class="delivery_title">
		        	<h1>送货区域</h1>
		            <p><img src="${base}/images/img_40.gif" width="8" height="8" alt="这是一张图片" />
					请您确认送货地点是否位于免费配送区域内</p>
		        </div>
		        <div class="map">
					<img src="${base}/images/mapbg_01.jpg" width="930" height="17" alt="" />
		        	<h1>Select&nbsp;your&nbsp;area&nbsp;&nbsp;选择区域</h1>
		            <p>目前我们已开通的送货区域自双井往国贸三环内、外3公里内，自国贸至三元桥、建国门至东直门二环至三环区间，三环外3公里内。如果您所需要送货地点位于此
						区域外，我们暂时不能提供免费配送。若有需要请联系XXX</p>
					<div class="map_img"><img src="${base}/images/map_01.jpg" width="563" height="538" alt="这是一张图片" /></div>
		        	<img src="${base}/images/mapbg_03.jpg" width="930" height="25" alt="" />
		        </div>
                <c:if test="${0 != fn:length(shopCar)}">
			        <div class="delivery_title">
			        	<h1>个人及配送信息</h1>
			            <h2><img src="${base}/images/img_40.gif" width="8" height="8" alt="这是一张图片" />
						请您确认送货地点是否位于免费配送区域内</h2>
			        </div>
					<form:form id="orderForm" commandName="order" method="post" action="${base}/orderFrontCtl/addOrder">
				        <table width="900" height="303" border="1">
							<tr>
			                    <td colspan="2"><input type="hidden" id="orderid" name="orderid" value="${order.orderid}" /></td>
			                </tr>
							<tr>
			                    <td width="296" height="55">&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Your name' : '姓名'}：</td>
			                    <td width="602" height="55" class="tb"><input type="text" id="username" name="username" class="in1" value="${order != null ? order.username : frontCurrentUser.username}" />&nbsp;*</td>
			                </tr>
			                <tr>
			                    <td>&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Phone/Mobile' : '电话/手机'}：</td>
			                    <td width="602" height="55" class="tb"><input type="text" id="phone" name="phone" class="in1" value="${order != null ? order.phone : frontCurrentUser.phone}" />&nbsp;*</td>
			                </tr>
			                <tr>
			                    <td>&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Email' : '邮件'}：</td>
			                    <td width="602" height="55" class="tb"><input type="text" name="email" id="email" class="in1" value="${order != null ? order.email : frontCurrentUser.email}" />&nbsp;*</td>
			                </tr>
			                <tr>
								<td>&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Preferred contact method' : '优先联系方式'}：</td>
								<td width="602" height="55" class="tb">
			                    	<select id="contact" name="contact" class="in3">
										<option value="0" selected>${i18n == 'en_US' ? 'Call' : '电话'}</option>
										<option value="1">email</option>
			                        </select>
								</td>
			                </tr>
			                <tr>
								<td>&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Delivery address' : '配送地址'}：</td>
								<td width="602" height="55" class="tb"><input type="text" name="site" id="site" class="in1" value="${order != null? order.site : frontCurrentUser.address}" />&nbsp;*</td>
			                </tr>
			                <tr>
								<td>&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Comment' : '备注'}：</td>
								<td width="602" height="55" class="tb"><input type="text" name="comment" id="comment" class="in1" value="${order.comment}" /></td>
			                </tr>
						</table>
			            <div class="delivery_title">
				            <h2>
				            	<img src="${base}/images/img_40.gif" width="8" height="8" alt="这是一张图片" />请您确认送货地点是否位于免费配送区域内
							</h2>
			        	</div>
			  
						<table width="900" height="174" border="1">
							<tr>
			                    <td width="296" height="43">&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Delivery date' : '配送日期'}：</td>
			                    <td width="602" height="43" class="tb">
			                    	<input type="text" name="servicedate" id="servicedate" class="Wdate" style="cursor:pointer; width:563px; height:23px; line-height:23px; margin-left:12px;" onfocus="servicedateFouce()" value="${order.servicedateStr}" />&nbsp;*
								</td>
			                </tr>
			                <tr>
			                    <td width="296" height="54">&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Preferred delivery time' : '优先配送时间'}：</td>
			                    <td width="602" height="54" class="tb">
			                    	<input type="text" name="servicetime" id="servicetime" class="Wdate" style="cursor:pointer; width:563px; height:23px; line-height:23px; margin-left:12px;" onfocus="WdatePicker({readonly:true,dateFmt:'HH:mm:ss'})" value="${order.servicetimeStr}" />&nbsp;*
			                    	&nbsp;&nbsp;&nbsp;We will confirm the time with you
								</td>
			                </tr>
			                <tr>
			                    <td width="296" height="75">&nbsp;&nbsp;&nbsp;${i18n == 'en_US' ? 'Delivery remarks' : '配送备注'}：</td>
			                    <td width="602" height="75" class="tb">
			                    	<input type="text" name="deliveryremark" id="deliveryremark" class="in1" value="${order.deliveryremark}" />
			                    	&nbsp;&nbsp;&nbsp;For any special arrangements please let us know 
								</td>
			                </tr>
			                <tr>
			                    <td width="296" height="75" colspan="2" align="center">
				                	<input type="submit" value="提交"/>
			                	</td>
			                </tr>
			            </table>
					</form:form>
				</c:if>
		    </div>
		    <%@ include file="/common/footer.jsp" %>
		</div>
	</body>
</html>